/**
 * @projectName study-note
 * @package Iterator
 * @className Iterator.Test
 */
package Iterator;

/**
 * Test
 * @description 测试类
 * @author answer_wx
 * @date 2022/7/4 11:14
 * @version 1.0
 */
public class Test {
    public static void main(String[] args) {
        ConcreteGather<String> concreteGather = new ConcreteGather<String>();
        concreteGather.add(0, "concreteGather0");
        concreteGather.add(1, "concreteGather1");
        concreteGather.add(2, "concreteGather2");
        concreteGather.add(3, "concreteGather3");
        concreteGather.add(4, "concreteGather4");

        Iterator<String> iterator = concreteGather.createIterator();
        System.out.println("正序0----" + iterator.first());
        while (!iterator.isDone()) {
            System.out.println(iterator.current());
            iterator.next();
        }

        Iterator<String> iteratorDesc = concreteGather.createIteratorDesc();
        System.out.println("倒序0----" + iteratorDesc.first());
        while (!iteratorDesc.isDone()) {
            System.out.println(iteratorDesc.current());
            iteratorDesc.next();
        }
    }
}